package com.framework.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.dao.sys.SysOpinionDao;
import com.framework.entity.sys.SysAgent;
import com.framework.entity.sys.SysOpinion;
import com.framework.service.AgentInfoService;
import com.framework.service.AgentService;
import com.framework.service.SysOpinionService;
import com.framework.validator.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author wq
 */
@Service("sysOpinionService")
public class SysOpinionServiceImpl extends ServiceImpl<SysOpinionDao, SysOpinion> implements SysOpinionService {


    @Autowired
    private AgentService agentService;

    @Override
    public void addOpinion(String token, String content) {
        SysAgent sysAgent = agentService.queryAgentByToken(token);
        Assert.isBlank(content,"请填写反馈意见");
        SysOpinion sysOpinion=new SysOpinion();
        sysOpinion.setAgentId(sysAgent.getAgentId());
        sysOpinion.setContent(content);
        sysOpinion.setCreateTime(new Date());
        sysOpinion.setDeptId(sysAgent.getDeptId());
        baseMapper.insert(sysOpinion);

    }
}
